<?php

namespace HuaweiCloud\SDK\Moderation\V2\Model;

use \ArrayAccess;
use HuaweiCloud\SDK\Core\Utils\ObjectSerializer;
use HuaweiCloud\SDK\Core\Utils\ModelInterface;
use HuaweiCloud\SDK\Core\SdkResponse;

class ImageDetectionResultDetail implements ModelInterface, ArrayAccess
{
    const DISCRIMINATOR = null;

    /**
    * The original name of the model.
    *
    * @var string
    */
    protected static $openAPIModelName = 'ImageDetectionResultDetail';

    /**
    * Array of property to type mappings. Used for (de)serialization
    * politics  涉政敏感人物检测结果。
    * porn  涉黄检测结果。
    * terrorism  涉政、暴恐检测结果。
    * ad  广告检测结果。
    *
    * @var string[]
    */
    protected static $openAPITypes = [
            'politics' => '\HuaweiCloud\SDK\Moderation\V2\Model\ImageDetectionResultDetailPolitics[]',
            'porn' => '\HuaweiCloud\SDK\Moderation\V2\Model\ImageDetectionResultSimpleDetail[]',
            'terrorism' => '\HuaweiCloud\SDK\Moderation\V2\Model\ImageDetectionResultSimpleDetail[]',
            'ad' => '\HuaweiCloud\SDK\Moderation\V2\Model\ImageDetectionResultAdDetail[]'
    ];

    /**
    * Array of property to format mappings. Used for (de)serialization
    * politics  涉政敏感人物检测结果。
    * porn  涉黄检测结果。
    * terrorism  涉政、暴恐检测结果。
    * ad  广告检测结果。
    *
    * @var string[]
    */
    protected static $openAPIFormats = [
        'politics' => null,
        'porn' => null,
        'terrorism' => null,
        'ad' => null
    ];

    /**
    * Array of property to type mappings. Used for (de)serialization
    *
    * @return array
    */
    public static function openAPITypes()
    {
        return self::$openAPITypes;
    }

    /**
    * Array of property to format mappings. Used for (de)serialization
    *
    * @return array
    */
    public static function openAPIFormats()
    {
        return self::$openAPIFormats;
    }

    /**
    * Array of attributes where the key is the local name,
    * and the value is the original name
    * politics  涉政敏感人物检测结果。
    * porn  涉黄检测结果。
    * terrorism  涉政、暴恐检测结果。
    * ad  广告检测结果。
    *
    * @var string[]
    */
    protected static $attributeMap = [
            'politics' => 'politics',
            'porn' => 'porn',
            'terrorism' => 'terrorism',
            'ad' => 'ad'
    ];

    /**
    * Array of attributes to setter functions (for deserialization of responses)
    * politics  涉政敏感人物检测结果。
    * porn  涉黄检测结果。
    * terrorism  涉政、暴恐检测结果。
    * ad  广告检测结果。
    *
    * @var string[]
    */
    protected static $setters = [
            'politics' => 'setPolitics',
            'porn' => 'setPorn',
            'terrorism' => 'setTerrorism',
            'ad' => 'setAd'
    ];

    /**
    * Array of attributes to getter functions (for serialization of requests)
    * politics  涉政敏感人物检测结果。
    * porn  涉黄检测结果。
    * terrorism  涉政、暴恐检测结果。
    * ad  广告检测结果。
    *
    * @var string[]
    */
    protected static $getters = [
            'politics' => 'getPolitics',
            'porn' => 'getPorn',
            'terrorism' => 'getTerrorism',
            'ad' => 'getAd'
    ];

    /**
    * Array of attributes where the key is the local name,
    * and the value is the original name
    *
    * @return array
    */
    public static function attributeMap()
    {
        return self::$attributeMap;
    }

    /**
    * Array of attributes to setter functions (for deserialization of responses)
    *
    * @return array
    */
    public static function setters()
    {
        return self::$setters;
    }

    /**
    * Array of attributes to getter functions (for serialization of requests)
    *
    * @return array
    */
    public static function getters()
    {
        return self::$getters;
    }

    /**
    * The original name of the model.
    *
    * @return string
    */
    public function getModelName()
    {
        return self::$openAPIModelName;
    }
    


    /**
    * Associative array for storing property values
    *
    * @var mixed[]
    */
    protected $container = [];

    /**
    * Constructor
    *
    * @param mixed[] $data Associated array of property values
    *                      initializing the model
    */
    public function __construct(array $data = null)
    {
        $this->container['politics'] = isset($data['politics']) ? $data['politics'] : null;
        $this->container['porn'] = isset($data['porn']) ? $data['porn'] : null;
        $this->container['terrorism'] = isset($data['terrorism']) ? $data['terrorism'] : null;
        $this->container['ad'] = isset($data['ad']) ? $data['ad'] : null;
    }

    /**
    * Show all the invalid properties with reasons.
    *
    * @return array invalid properties with reasons
    */
    public function listInvalidProperties()
    {
        $invalidProperties = [];
        return $invalidProperties;
    }

    /**
    * Validate all the properties in the model
    * return true if all passed
    *
    * @return bool True if all properties are valid
    */
    public function valid()
    {
        return count($this->listInvalidProperties()) === 0;
    }

    /**
    * Gets politics
    *  涉政敏感人物检测结果。
    *
    * @return \HuaweiCloud\SDK\Moderation\V2\Model\ImageDetectionResultDetailPolitics[]|null
    */
    public function getPolitics()
    {
        return $this->container['politics'];
    }

    /**
    * Sets politics
    *
    * @param \HuaweiCloud\SDK\Moderation\V2\Model\ImageDetectionResultDetailPolitics[]|null $politics 涉政敏感人物检测结果。
    *
    * @return $this
    */
    public function setPolitics($politics)
    {
        $this->container['politics'] = $politics;
        return $this;
    }

    /**
    * Gets porn
    *  涉黄检测结果。
    *
    * @return \HuaweiCloud\SDK\Moderation\V2\Model\ImageDetectionResultSimpleDetail[]|null
    */
    public function getPorn()
    {
        return $this->container['porn'];
    }

    /**
    * Sets porn
    *
    * @param \HuaweiCloud\SDK\Moderation\V2\Model\ImageDetectionResultSimpleDetail[]|null $porn 涉黄检测结果。
    *
    * @return $this
    */
    public function setPorn($porn)
    {
        $this->container['porn'] = $porn;
        return $this;
    }

    /**
    * Gets terrorism
    *  涉政、暴恐检测结果。
    *
    * @return \HuaweiCloud\SDK\Moderation\V2\Model\ImageDetectionResultSimpleDetail[]|null
    */
    public function getTerrorism()
    {
        return $this->container['terrorism'];
    }

    /**
    * Sets terrorism
    *
    * @param \HuaweiCloud\SDK\Moderation\V2\Model\ImageDetectionResultSimpleDetail[]|null $terrorism 涉政、暴恐检测结果。
    *
    * @return $this
    */
    public function setTerrorism($terrorism)
    {
        $this->container['terrorism'] = $terrorism;
        return $this;
    }

    /**
    * Gets ad
    *  广告检测结果。
    *
    * @return \HuaweiCloud\SDK\Moderation\V2\Model\ImageDetectionResultAdDetail[]|null
    */
    public function getAd()
    {
        return $this->container['ad'];
    }

    /**
    * Sets ad
    *
    * @param \HuaweiCloud\SDK\Moderation\V2\Model\ImageDetectionResultAdDetail[]|null $ad 广告检测结果。
    *
    * @return $this
    */
    public function setAd($ad)
    {
        $this->container['ad'] = $ad;
        return $this;
    }

    /**
    * Returns true if offset exists. False otherwise.
    *
    * @param integer $offset Offset
    *
    * @return boolean
    */
    public function offsetExists($offset)
    {
        return isset($this->container[$offset]);
    }

    /**
    * Gets offset.
    *
    * @param integer $offset Offset
    *
    * @return mixed
    */
    public function offsetGet($offset)
    {
        return isset($this->container[$offset]) ? $this->container[$offset] : null;
    }

    /**
    * Sets value based on offset.
    *
    * @param integer $offset Offset
    * @param mixed   $value  Value to be set
    *
    * @return void
    */
    public function offsetSet($offset, $value)
    {
        if (is_null($offset)) {
                $this->container[] = $value;
            } else {
                $this->container[$offset] = $value;
        }
    }

    /**
    * Unsets offset.
    *
    * @param integer $offset Offset
    *
    * @return void
    */
    public function offsetUnset($offset)
    {
        unset($this->container[$offset]);
    }

    /**
    * Gets the string presentation of the object
    *
    * @return string
    */
    public function __toString()
    {
        return json_encode(
            ObjectSerializer::sanitizeForSerialization($this),
            JSON_PRETTY_PRINT
        );
    }
}

